//
//  LSZHistoryTableViewCell.m
//  JKFuYinProject
//
//  Created by 九酷 on 2018/8/15.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "LSZHistoryTableViewCell.h"

@implementation LSZHistoryTableViewCell

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageViewHeader = [[UIImageView alloc]init];
        [self.imageViewHeader.layer setMasksToBounds:YES];
        [self addSubview:self.imageViewHeader];

        self.labelName = [[UILabel alloc]init];
        self.labelName.textColor = titleColorLSZ;
        [LSZSpecialPackaging setLabelAdaptiveSize:self.labelName font:14.5];
        [self addSubview:self.labelName];

        self.labelTime = [[UILabel alloc]init];
        self.labelTime.textColor = lightColor;
//        self.labelTime.backgroundColor = [UIColor yellowColor];
        [LSZSpecialPackaging setLabelAdaptiveSize:self.labelTime font:10];
        [self addSubview:self.labelTime];

        self.labelType = [[UILabel alloc]init];
        self.labelType.textColor = lightColor;
        self.labelType.textAlignment = NSTextAlignmentRight;
        [LSZSpecialPackaging setLabelAdaptiveSize:self.labelType font:13.5];
        [self addSubview:self.labelType];

        self.labelTitle = [[UILabel alloc]init];
        self.labelTitle.numberOfLines = 0;
        self.labelTitle.textColor = titleColorLSZ;
        [LSZSpecialPackaging setLabelAdaptiveSize:self.labelTitle font:13.5];
        [self addSubview:self.labelTitle];

        if (ScreenWidth == 320) {
            //5
            self.imageViewHeader.frame = CGRectMake(10, 10, 25, 25);
            self.labelName.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeader.frame)+5, CGRectGetMinY(self.imageViewHeader.frame), ScreenWidth/2, 16);
            self.labelTime.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeader.frame)+5, CGRectGetMaxY(self.labelName.frame), ScreenWidth/2, 9);
            self.labelType.frame = CGRectMake(CGRectGetMaxX(self.labelName.frame), CGRectGetMinY(self.imageViewHeader.frame)+(self.imageViewHeader.frame.size.height-16)/2, ScreenWidth-10-CGRectGetMaxX(self.labelName.frame), 16);
            self.labelTitle.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeader.frame)+5, CGRectGetMaxY(self.imageViewHeader.frame)+3, ScreenWidth-CGRectGetMaxX(self.imageViewHeader.frame)-10, 20);
        }else if(ScreenWidth == 375){
            // 6 7
            self.imageViewHeader.frame = CGRectMake(10, 10, 30, 30);
            self.labelName.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeader.frame)+5, CGRectGetMinY(self.imageViewHeader.frame),ScreenWidth/2, 18);
            self.labelTime.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeader.frame)+5, CGRectGetMaxY(self.labelName.frame), ScreenWidth/2, 12);
            self.labelType.frame = CGRectMake(CGRectGetMaxX(self.labelName.frame), CGRectGetMinY(self.imageViewHeader.frame)+(self.imageViewHeader.frame.size.height-18)/2, ScreenWidth-10-CGRectGetMaxX(self.labelName.frame), 18);
            self.labelTitle.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeader.frame)+5, CGRectGetMaxY(self.imageViewHeader.frame)+3, ScreenWidth-CGRectGetMaxX(self.imageViewHeader.frame)-10, 20);
        }else {
            //plus
            self.imageViewHeader.frame = CGRectMake(10, 10, 35, 35);
            self.labelName.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeader.frame)+5, CGRectGetMinY(self.imageViewHeader.frame), ScreenWidth/2, 20);
            self.labelTime.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeader.frame)+5, CGRectGetMaxY(self.labelName.frame), ScreenWidth/2, 15);
            self.labelType.frame = CGRectMake(CGRectGetMaxX(self.labelName.frame), CGRectGetMinY(self.imageViewHeader.frame)+(self.imageViewHeader.frame.size.height-20)/2, ScreenWidth-10-CGRectGetMaxX(self.labelName.frame), 20);
            self.labelTitle.frame = CGRectMake(CGRectGetMaxX(self.imageViewHeader.frame)+5, CGRectGetMaxY(self.imageViewHeader.frame)+3, ScreenWidth-CGRectGetMaxX(self.imageViewHeader.frame)-10, 20);
        }
        [self.imageViewHeader.layer setCornerRadius:self.imageViewHeader.frame.size.height/2];
    }
    return self;
}

@end
